package com.foreknow.service.impl;

import com.foreknow.dao.UserMapper;
import com.foreknow.entity.User;
import com.foreknow.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserMapper userMapper;

    @Override
    public User LoginService(String username, String password) {
        User user = userMapper.Login(username, password);
        return user;
    }

    @Override
    public List<User> getQueryAllUser(User user) {
        return userMapper.findUser(user);
    }

    @Override
    public int insertUser(User user) {
        return userMapper.insert(user);
    }

    @Override
    public int deleteUser(Integer id) {
        return userMapper.deleteByPrimaryKey(id);
    }

    @Override
    public int updateUser(User user) {
        return userMapper.updateByPrimaryKey(user);
    }

    @Override
    public User selectUser(Integer id) {
        return userMapper.selectByPrimaryKey(id);
    }
}
